package com.ea.eadp.nexus.test.workflow.pc.login;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

import com.ea.eadp.nexus.test.common.PageOperation;
import com.ea.eadp.nexus.test.workflow.WorkflowElementArgument;

public class LoginWorkFlowElement extends LoginWorkflowElementBase {
    
    public LoginWorkFlowElement(
        WebDriver driver, WorkflowElementArgument args
    ) {
        super(driver, args);
    }
    
    @Override
    public void doAction(){
        log.info("Input Origin ID: " + args.originId);
        PageOperation.SendKeyToElementAfterWait(driver, "email", args.originId);
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
        log.info("Input password: " + args.password);
        PageOperation.SendKeyToElementAfterWait(driver, "password", args.password);
    }
    
    @Override
    public void moveNext() {
        WebElement loginBtn = driver.findElement(
            By.xpath("//a[@id='btnLogin']")
        );
        loginBtn.click();
    }
    
}
